Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AbstractCloudSlave and AbstractCloudComputer #1015

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

car-roll
Copy link
Contributor

@car-roll car-roll commented Dec 2, 2024

supersedes #998

Testing done

  • Manual testing

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@car-roll car-roll mentioned this pull request Dec 2, 2024
7 tasks
@@ -456,7 +458,8 @@ public void terminate() {
Jenkins.get().removeNode(this);
LOGGER.info("Removed EC2 instance from jenkins controller: " + getInstanceId());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these INFO log messages could probably be replaced with messages to the TaskListener.

@@ -196,7 +198,8 @@ public void terminate() {
LOGGER.info("Cancelled Spot request: " + spotInstanceRequestId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here

}
}
}
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to remove agent: ", e);
Functions.printStackTrace(e, listener.error("Failed to remove agent"));
} finally {
// Remove the instance even if deletion failed, otherwise it will hang around forever in
// the nodes page. One way for this to occur is that an instance was terminated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pay attention to https://github.com/jenkinsci/jenkins/blob/4248fc0ca6ce108364ed23208063ff20753f5e70/core/src/main/java/hudson/slaves/AbstractCloudSlave.java#L88-L94 which means that after switching fromterminate to _terminate it is no longer your responsibility to removeNode.

@@ -456,7 +458,8 @@ public void terminate() {
Jenkins.get().removeNode(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here

@@ -178,7 +180,7 @@ protected boolean isAlive(boolean force) {
* Cancel the spot request for the instance. Terminate the instance if it is up. Remove the agent from Jenkins.
*/
@Override
public void terminate() {
protected void _terminate(TaskListener listener) throws IOException, InterruptedException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impl seems mostly the same as in EC2OndemandSlave. Is there a reason the method cannot simply be pulled up into EC2AbstractSlave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants